import { defHttp } from '@/utils/http/axios';
enum Api {
  addRootMenuApi = '/sys/permission/addRootMenu',
  addItemMenuApi = '/sys/permission/addItemMenu',
  updateMenuApi="/sys/permission/update"
}

//
export function addRootMenu(params) {
  return defHttp
    .post(
      {
        url: Api.addRootMenuApi,
        params,
      },
      {
        isTransformResponse: false,
      },
    )
    .then((res) => {
      return res;
    })
    .catch((err) => {
      console.log(err, '添加父目录');
    });
}
//子目录
export function addItemMenu(params) {
  return defHttp
    .post(
      {
        url: Api.addItemMenuApi,
        params,
      },
      {
        isTransformResponse: false,
      },
    )
    .then((res) => {
      return res;
    })
    .catch((err) => {
      console.log(err, '添加父目录');
    });
}

export function updateMenu(params) {
  return defHttp
    .post(
      {
        url: Api.updateMenuApi,
        params,
      },
      {
        isTransformResponse: false,
      },
    )
    .then((res) => {
      return res;
    })
    .catch((err) => {
      console.log(err, '添加父目录');
    });
}
